<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.org/ui"
                template="resources/templates/mainTemplate.xhtml">
    
    <ui:param name="pagetitle" value="CHUMS - Manage User Activities"/>
    
    <ui:define name="centerContent" class="turquaz">   
    
        <p:ajaxStatus onstart="statusDialog.show();" onsuccess="statusDialog.hide();"/>  

        <p:dialog appendToBody="true" resizable="false" modal="true" widgetVar="statusDialog" header="Loading"   
                  draggable="false" closable="false">  
            <p:graphicImage value="resources/images/ajax-loader.gif" />
        </p:dialog> 
        
        
        
        <center>
            <h:form id="formMyActivities" prependId="false" >
                <p:fieldset legend="User Activities">  
                    <h:panelGrid columns="1"  cellpadding="10"> 
                        <p:growl id="growlMyActivities"  showDetail="true" showSummary="false" life="5000" redisplay="false" />  
                        <p:dataTable id="myActivitiesTableID" 
                                     var="activity" 
                                     value="#{userActivityBean.allActivities}" 
                                     paginator="true" 
                                     rows="10"
                                     rowsPerPageTemplate="10,15,20"
                                     rowKey="#{activity.id}"
                                     emptyMessage="No Rows"
                                     editable="true">

                            <p:ajax event="filter" listener="#{userActivityBean.onFilter}" update = ":formMyActivities:myActivitiesTableID"/>

                            <f:facet name="header">
                                <h:outputText value="User Activities" />
                            </f:facet>

                            
                            <p:column sortBy="#{activity.userText}" 
                                      headerText="Name" 
                                      filterBy="#{activity.userText}"  
                                      filterMatchMode="contains"
                                      >

                                <f:facet name="header">
                                    <h:outputText value="Name" />
                                </f:facet>

                                <h:outputText value="#{activity.userText}" />
                            </p:column>

                            <p:column sortBy="#{activity.activityTypeText}" 
                                      headerText="Activity" 
                                      filterBy="#{activity.activityTypeText}"  
                                      filterMatchMode="contains"
                                      >

                                <f:facet name="header">
                                    <h:outputText value="Activity" />
                                </f:facet>

                                <h:outputText value="#{activity.activityTypeText}" />
                            </p:column>
                            
                            <p:column sortBy="#{activity.webResourceText}" 
                                      headerText="Resource" 
                                      filterBy="#{activity.webResourceText}"  
                                      filterMatchMode="contains"
                                      >

                                <f:facet name="header">
                                    <h:outputText value="Resource" />
                                </f:facet>

                                <h:outputText value="#{activity.webResourceText}" />
                            </p:column>
                            
                            <p:column sortBy="#{activity.activityValue}" 
                                      headerText="Value" 
                                      filterBy="#{activity.activityValue}"  
                                      filterMatchMode="contains"
                                      >

                                <f:facet name="header">
                                    <h:outputText value="Value" />
                                </f:facet>

                                <h:outputText value="#{activity.activityValue}" />
                            </p:column>
                            
                            <p:column sortBy="#{activity.time}" 
                                      headerText="Date" 
                                      filterBy="#{activity.time}"  
                                      filterMatchMode="contains"
                                      >

                                <f:facet name="header">
                                    <h:outputText value="Date" />
                                </f:facet>

                                <h:outputText value="#{activity.time}" />
                            </p:column>
                           
                            
                        </p:dataTable>

                    </h:panelGrid>  

                </p:fieldset>
            </h:form> 
            
        </center>
        
    </ui:define>
    
    <ui:define name="leftContent" class="turquaz">
        <ui:include src="managementLeftPanel.xhtml" />
    </ui:define> 
    
</ui:composition>

